import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttendanceDetailVO, AttendanceDetailForm, AttendanceDetailQuery } from '@/api/dormitory/attendanceDetail/types';

/**
 * 查询宿舍考勤明细列表
 * @param query
 * @returns {*}
 */

export const listAttendanceDetail = (query?: AttendanceDetailQuery): AxiosPromise<AttendanceDetailVO[]> => {
  return request({
    url: '/dormitory/attendanceDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询宿舍考勤明细详细
 * @param id
 */
export const getAttendanceDetail = (id: string | number): AxiosPromise<AttendanceDetailVO> => {
  return request({
    url: '/dormitory/attendanceDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增宿舍考勤明细
 * @param data
 */
export const addAttendanceDetail = (data: AttendanceDetailForm) => {
  return request({
    url: '/dormitory/attendanceDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改宿舍考勤明细
 * @param data
 */
export const updateAttendanceDetail = (data: AttendanceDetailForm) => {
  return request({
    url: '/dormitory/attendanceDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除宿舍考勤明细
 * @param id
 */
export const delAttendanceDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/attendanceDetail/' + id,
    method: 'delete'
  });
};
